package com.atcumt.alibaba;

/* 
 * "circle",628
 * 31400
 * 
 * "square",8
 * 4
 */
public class HX01 {

    public static void main(String[] args) {
        int area = getArea("circle", 628);
        int area2 = getArea("square", 8);
        System.out.println(area);
        System.out.println(area2);
    }

    public static int getArea(String shape, int perimeter) {
        // write code here
        int len;
        int area;
        // int pi = (int) 3.14;
        if (shape == "circle") {
            len = (int) (perimeter / (2 * 3.14));
            area = (int) (3.14 * len * len);
        } else {
            len = perimeter / 4;
            area = (len * len);
        }
        return area;
    }

    /*
     * 元音字母：aeiou
     * "aBcdE"
     * 3
     */
    public int uppercase(String str) {
        // write code here
        int count = 0;
        char[] chars = str.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            if (Character.isUpperCase(chars[i])) {
                if(chars[i] == 'A' || chars[i] == 'E' || chars[i] == 'I' || chars[i] == 'O' || chars[i] == 'U') {
                    count++;
                }
                continue;
            }
            if (Character.isLowerCase(chars[i])) {
                if (chars[i] != 'a' && chars[i] != 'e' || chars[i] != 'i' || chars[i] != 'o' || chars[i] != 'u') {
                    count++;
                }
                continue;
            }
        }
        return count;
    }
}
